package com.itheima.kejianxing;

import java.util.Objects;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Demo01 {

    public static void main(String[] args) {
        P p = new P();
        Lu lu = new Lu();
        lu.start();
        p.start();


    }

}
class Money{
    //开通短信服务
  /* volatile*/ static int money=100000;
        public static Object obj= new Object();
        public static Lock lock= new ReentrantLock();

}
class  P extends Thread{
    @Override
    public void run() {
        //synchronized (Money.obj) {
        Money.lock.lock();
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            Money.money-=10000;
            System.out.println("我买皮肤去了哦");
        Money.lock.unlock();
        //  }
    }
}
class Lu extends Thread{
    @Override
    public void run() {

        while (Money.money==100000){
          //  synchronized (Money.obj) {
            Money.lock.lock();
               int I=1;
            Money.lock.unlock();
            //}
        }

        System.out.println("妈呀,我的结婚钱呢,分手");

    }
}
